package com.example.design_pattern.factory.abstracts;


import com.example.design_pattern.factory.abstracts.facroty.ChicagoPizzaStore;
import com.example.design_pattern.factory.abstracts.facroty.NYPizzaStore;
import com.example.design_pattern.factory.abstracts.facroty.PizzaStore;
import com.example.design_pattern.factory.abstracts.products.Pizza;
import com.example.design_pattern.factory.simple.PizzaTypeEnums;

/**
 *  抽象工厂
 *  工厂方法是抽象方法，依赖子类工厂处理对象的创建
 *  工厂方法必须返回返回一个对象（超类对象）
 *
 *  依赖倒置原则
 *  要依赖抽象，不要依赖具体类
 */
public class Test {

    public static void main(String[] args) {

        PizzaStore nyStore = new NYPizzaStore();
        PizzaStore chicagoStore = new ChicagoPizzaStore();

        Pizza pizza = nyStore.orderPizza(PizzaTypeEnums.cheese.name());
        System.out.println("Ethan ordered a "+pizza.getName() +"\n");

        pizza = chicagoStore.orderPizza(PizzaTypeEnums.cheese.name());
        System.out.println("Joel ordered a "+pizza.getName() +"\n");
    }
}
